from sklearn.preprocessing import PolynomialFeatures
import numpy as np

x = np.arange(1, 10).reshape(3, 3)
print(x)
pl = PolynomialFeatures(degree=2)
x_poly = pl.fit_transform(x)
print(x_poly)

pl2 = PolynomialFeatures(degree=2, include_bias=False)
x_poly2 = pl2.fit_transform(x)
print(x_poly2)

# no X1^2 X2^2 ... only X1*X2, X1*X3, ...
pl3 = PolynomialFeatures(degree=2, interaction_only=True)
x_poly3 = pl3.fit_transform(x)
print(x_poly3)
